package cn.edu.nju.software.cdiy.bean;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

public class MainBoard extends Hardware implements Comparable<MainBoard>, Serializable {

	private static final long serialVersionUID = -8800838672013944499L;
	private int id;
	// 型号1
	private String model;// 主板型号

	// 外键品牌表2
	private BRD_MB brand;// 主板品牌
	private BRD_CPU CPUManu;// CPU生产厂商

	// 外键码表6
	private Value chipSet;// 芯片组
	private Value compatibleMEM;// 适用内存类型
	private Value MBArchitect;// 主板板型
	private Value maxMem;// 最大支持内存
	private Value compatibleTunnel;// 支持通道

	// 外键接口表2
	private Interface powerInterface;// 电源接口
	private Interface CPUSlot;// CPU插槽
	private Interface memSlot;// 内存插槽

	// 一对多
	private Set<MB_CPUXL> cpuxlSet;// CPU系列
	private Set<MB_Interface> mbiSet;// 主板接口
	private Set<MB_MemFrequency> mbmfSet;// 支持内存频率

	// 次要指标11
	private int memSlotNum;// 内存插槽数目
	private String specialFeature;// 特色功能
	private String sizeOfMB;// 主板尺寸
	private String attachment;// 附件
	private String CSPhone;// 客服电话
	private String qualityPolicy;// 质保政策
	private String qualityTime;// 质保时间
	private String qualityContent;// 质保具体内容
	private String soundCard;// 板载声卡
	private String networkAdapter;// 板载网卡
	private String RAID;// 磁盘阵列
	private String powerMode;// 供电模式

	// 管理类参数6
	private int iPrice;// 入库价格
	private int oPrice;// 出库价格
	private double performance;// 性能
	private Date inStorageTime;// 入库时间
	private String imgPath;// 图片路径
	private Value state;// 状态 //外键；{0:审核中 1:已通过}
	private double wScore;// 网友评分
	private double zScore;// 专家评分
	private int supplier;// 供货商

	private int sale;// 销售量
	private int ratedPower;// 预留信息
	private String rsv3;// 预留信息

	public Set<MB_CPUXL> getCpuxlSet() {
		return cpuxlSet;
	}

	public void setCpuxlSet(Set<MB_CPUXL> cpuxlSet) {
		this.cpuxlSet = cpuxlSet;
	}

	public Set<MB_Interface> getMbiSet() {
		return mbiSet;
	}

	public void setMbiSet(Set<MB_Interface> mbiSet) {
		this.mbiSet = mbiSet;
	}

	public Set<MB_MemFrequency> getMbmfSet() {
		return mbmfSet;
	}

	public void setMbmfSet(Set<MB_MemFrequency> mbmfSet) {
		this.mbmfSet = mbmfSet;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public BRD_MB getBrand() {
		return brand;
	}

	public void setBrand(BRD_MB brand) {
		this.brand = brand;
	}

	public BRD_CPU getCPUManu() {
		return CPUManu;
	}

	public void setCPUManu(BRD_CPU cPUManu) {
		CPUManu = cPUManu;
	}

	public Value getChipSet() {
		return chipSet;
	}

	public void setChipSet(Value chipSet) {
		this.chipSet = chipSet;
	}

	public Value getCompatibleMEM() {
		return compatibleMEM;
	}

	public void setCompatibleMEM(Value compatibleMEM) {
		this.compatibleMEM = compatibleMEM;
	}

	public Value getMBArchitect() {
		return MBArchitect;
	}

	public void setMBArchitect(Value mBArchitect) {
		MBArchitect = mBArchitect;
	}

	public Value getMaxMem() {
		return maxMem;
	}

	public void setMaxMem(Value maxMem) {
		this.maxMem = maxMem;
	}

	public Value getCompatibleTunnel() {
		return compatibleTunnel;
	}

	public void setCompatibleTunnel(Value compatibleTunnel) {
		this.compatibleTunnel = compatibleTunnel;
	}

	public int getMemSlotNum() {
		return memSlotNum;
	}

	public void setMemSlotNum(int memSlotNum) {
		this.memSlotNum = memSlotNum;
	}

	public Interface getPowerInterface() {
		return powerInterface;
	}

	public void setPowerInterface(Interface powerInterface) {
		this.powerInterface = powerInterface;
	}

	public Interface getCPUSlot() {
		return CPUSlot;
	}

	public void setCPUSlot(Interface cPUSlot) {
		CPUSlot = cPUSlot;
	}

	public Interface getMemSlot() {
		return memSlot;
	}

	public void setMemSlot(Interface memSlot) {
		this.memSlot = memSlot;
	}

	public String getSpecialFeature() {
		return specialFeature;
	}

	public void setSpecialFeature(String specialFeature) {
		this.specialFeature = specialFeature;
	}

	public String getSizeOfMB() {
		return sizeOfMB;
	}

	public void setSizeOfMB(String sizeOfMB) {
		this.sizeOfMB = sizeOfMB;
	}

	public String getAttachment() {
		return attachment;
	}

	public void setAttachment(String attachment) {
		this.attachment = attachment;
	}

	public String getCSPhone() {
		return CSPhone;
	}

	public void setCSPhone(String cSPhone) {
		CSPhone = cSPhone;
	}

	public String getQualityPolicy() {
		return qualityPolicy;
	}

	public void setQualityPolicy(String qualityPolicy) {
		this.qualityPolicy = qualityPolicy;
	}

	public String getQualityTime() {
		return qualityTime;
	}

	public void setQualityTime(String qualityTime) {
		this.qualityTime = qualityTime;
	}

	public String getQualityContent() {
		return qualityContent;
	}

	public void setQualityContent(String qualityContent) {
		this.qualityContent = qualityContent;
	}

	public String getSoundCard() {
		return soundCard;
	}

	public void setSoundCard(String soundCard) {
		this.soundCard = soundCard;
	}

	public String getNetworkAdapter() {
		return networkAdapter;
	}

	public void setNetworkAdapter(String networkAdapter) {
		this.networkAdapter = networkAdapter;
	}

	public String getRAID() {
		return RAID;
	}

	public void setRAID(String rAID) {
		RAID = rAID;
	}

	public String getPowerMode() {
		return powerMode;
	}

	public void setPowerMode(String powerMode) {
		this.powerMode = powerMode;
	}

	public int getiPrice() {
		return iPrice;
	}

	public void setiPrice(int iPrice) {
		this.iPrice = iPrice;
	}

	public int getoPrice() {
		return oPrice;
	}

	public void setoPrice(int oPrice) {
		this.oPrice = oPrice;
	}

	public double getPerformance() {
		return performance;
	}

	public void setPerformance(double performance) {
		this.performance = performance;
	}

	public Date getInStorageTime() {
		return inStorageTime;
	}

	public void setInStorageTime(Date inStorageTime) {
		this.inStorageTime = inStorageTime;
	}

	public String getImgPath() {
		return imgPath;
	}

	public void setImgPath(String imgPath) {
		this.imgPath = imgPath;
	}

	public double getwScore() {
		return wScore;
	}

	public void setwScore(double wScore) {
		this.wScore = wScore;
	}

	public double getzScore() {
		return zScore;
	}

	public void setzScore(double zScore) {
		this.zScore = zScore;
	}

	public int getSupplier() {
		return supplier;
	}

	public void setSupplier(int supplier) {
		this.supplier = supplier;
	}

	public int getSale() {
		return sale;
	}

	public void setSale(int sale) {
		this.sale = sale;
	}

	public int getRatedPower() {
		return ratedPower;
	}

	public void setRatedPower(int ratedPower) {
		this.ratedPower = ratedPower;
	}

	public String getRsv3() {
		return rsv3;
	}

	public void setRsv3(String rsv3) {
		this.rsv3 = rsv3;
	}

	@Override
	public int compareTo(MainBoard o) {

		Date now = new Date();

		// this的热度
		long gap = now.getTime() - inStorageTime.getTime();
		int gapDay = (int) (gap / (24 * 3600 * 1000)) + 1;

		double nowHot = sale / gapDay;

		// 参数的hot
		long oGap = now.getTime() - o.getInStorageTime().getTime();
		int oGapDay = (int) (oGap / (24 * 3600 * 1000)) + 1;

		double oHot = o.getSale() / oGapDay;

		// 降序排列
		if (nowHot > oHot)
			return -1;
		else if (nowHot == oHot)
			return 0;
		else
			return 1;
	}

	public Value getState() {
		return state;
	}

	public void setState(Value state) {
		this.state = state;
	}

}
